package br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.allequips;

import br.edu.ufcg.lsd.wbis.ui.client.beans.EquipInfo;
import br.edu.ufcg.lsd.wbis.ui.client.beans.UserInfo;
import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.GenericTabPanel;
import br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin.Updatable;
import br.edu.ufcg.lsd.wbis.ui.client.ui.management.InfoManager;

import com.gwtext.client.widgets.TabPanel;
import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.ToolbarButton;

/**
 * @author Renato Miceli
 */
public class EquipInfoViewerToolbar extends Toolbar implements Updatable<EquipInfo> {

	private final EquipInfoTabOpenerListener tabOpener;

	public EquipInfoViewerToolbar(TabPanel centerPanel, InfoManager<UserInfo> loggedManager) {

		this.tabOpener = new EquipInfoTabOpenerListener(centerPanel, loggedManager);

		this.addFill();
		this.addButton(new ToolbarButton("Details", tabOpener));
	}

	public EquipInfoViewerToolbar(EquipInfo info, TabPanel centerPanel, InfoManager<UserInfo> loggedManager) {
		this(centerPanel, loggedManager);
		updateInfo(info);
	}

	public void updateInfo(EquipInfo info) {
		this.tabOpener.updateInfo(info);
	}

	public GenericTabPanel getParentTab() {
		// TODO Auto-generated method stub
		return null;
	}
}
